package sword.T3;

/**
 * @File Info: leetcode -- <Solution>
 * @Author: 18362
 * @Create: 2022-03-23 0:20:57 星期三
 */

class Solution {
    public int findRepeatNumber(int[] nums) {
        int i = 0;
        while (i < nums.length) {
            while (nums[i] != i) {
                if (nums[nums[i]] == nums[i])
                    return nums[i];
                int idx = nums[i];
                int temp = nums[i];
                nums[i] = nums[idx];
                nums[idx] = temp;
            }
            i++;
        }
        return 0;
    }
}